import { defineStore } from 'pinia'
import { getApiList } from '../server/index'
import type { Data,Children,ChinaAdd, ChinaTotal,LocalCityNCOVDataList } from './type'

export const useStore = defineStore({
  id: 'counter',
  state: () => ({
    list:<Data>{},
    item:<Children[]>[],
    chinaAdd:<ChinaAdd>{},
    chinaTotal:<ChinaTotal>{},
    cityDetail:<LocalCityNCOVDataList[]>[]
  }),
  actions:{
    async getList (){
      const res = await getApiList()
      this.list = res
      this.chinaAdd = res.diseaseh5Shelf.chinaAdd
      this.chinaTotal = res.diseaseh5Shelf.chinaTotal
      this.cityDetail = res.localCityNCOVDataList
    }
  }
})
